package cfca.payment.socket;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.w3c.dom.Document;
import org.w3c.dom.Element;

import payment.api.tx.TxBaseRequest;

public class Tx9999Request extends TxBaseRequest
{
  private String institutionID;

  public Tx9999Request()
  {
    this.txCode = "9999";
  }

  public void process()
    throws Exception
  {
    DocumentBuilderFactory localDocumentBuilderFactory = DocumentBuilderFactory.newInstance();
    DocumentBuilder localDocumentBuilder = localDocumentBuilderFactory.newDocumentBuilder();
    Document localDocument = localDocumentBuilder.newDocument();

    Element localElement1 = localDocument.createElement("Request");
    Element localElement2 = localDocument.createElement("Head");
    Element localElement3 = localDocument.createElement("Body");
    Element localElement4 = localDocument.createElement("TxCode");
    Element localElement5 = localDocument.createElement("InstitutionID");

    localElement1.setAttribute("version", "2.1");
    localDocument.appendChild(localElement1);
    localElement1.appendChild(localElement2);
    localElement1.appendChild(localElement3);
    localElement2.appendChild(localElement4);
    localElement4.setTextContent(this.txCode);
    localElement3.appendChild(localElement5);
    localElement5.setTextContent(this.institutionID);

    postProcess(localDocument);
  }

  public String getInstitutionID() {
    return this.institutionID;
  }

  public void setInstitutionID(String paramString) {
    this.institutionID = paramString;
  }
}